<extend name="Public/base"/>


<block name="style">
	
	<style type="text/css">
	.choosed{
		height: 83%;
	}
	
	.not-choosed{
		
		height: 83%;
	}
	.fl{
		float: left;
		margin:0 10px;
	}
	.well{
		background: #fff;
	}
	</style>
</block>

<block name="body">
<script type="text/css">
  .add{
       width:100px; 
      }
</script>

<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title cf">
        <h2>
            <if condition="ACTION_NAME eq 'add'">新增项目需求
                <else/>  编辑项目需求
            </if>
        </h2>
    </div>
    <!-- 表单 -->
  <form action="" method="post" class="form-horizontal">
    <div class="with-padding">
    
    <div class="tab-wrap" style="margin-bottom: 5px">
        <ul class="nav nav-secondary group_nav">
            <li class="active"><a href="javascript:">基本信息</a></li>
            <li class=""><a href="javascript:">详细信息</a></li>            
        </ul>
    </div>
    
                    <!--看板-->
        <div class="group_list" style="">
        
				   <div class="form-item cf">
		                <label class="item-label">项目需求名称<span class="check-tips"></span></label>		
		                <div class="controls">
		                    <input type="text" class="text input-large form-control form-input-width" name="tecname"
		                           value="{$data.xname}">
		                </div>
                   </div>
                   
                   <div class="form-item cf">
		                <label class="item-label">联系人<span class="check-tips"></span></label>		
		                <div class="controls">
		                    <input type="text" class="text input-large form-control form-input-width" name="tecname"
		                           value="{$data.rName}">
		                </div>
                   </div>
                   
                   <div class="form-item cf">
		                <label class="item-label">联系方式<span class="check-tips"></span></label>		
		                <div class="controls">
		                    <input type="text" class="text input-large form-control form-input-width" name="tecname"
		                           value="{$data.xtelephone}">
		                </div>
                   </div>
            
            </br>
            
		            <div class="form-item cf">
		                <label class="item-label">需求描述<span class="check-tips"></span></label>
		                  <textarea name="detdes" class="form-control" style="width: 400px;height: 200px" >{$data.detdes}</textarea>
		            </div>
		            
		            <div class="form-item cf">
		                <label class="item-label">需求背景<span class="check-tips"></span></label>
		                  <textarea name="dembg" class="form-control" style="width: 400px;height: 200px" >{$data.dembg}</textarea>
		            </div>
            
                   <div class="form-item cf">
				     <label class="item-label">上传图片<span class="check-tips"></span></label>
				     	<div class="controls">
				            <div id="upload_single_image_" style="padding-bottom: 5px;">选择图片</div>
				            <input class="attach" type="hidden" name="" value="{$data.pic}"/>
				            <div class="upload-img-box">
				                <div class="upload-pre-item popup-gallery">
								<notempty name="data.pic">
									<div class="each">
									<a href="{$data.pic}" title="点击查看大图"><img src="{$data.pic}"></a>
									<div class="text-center opacity del_btn" ></div>
									<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div>
									</div>
				                </notempty>           
				                </div>
				            </div>
				        </div>        
	               </div> 
             
             </br>                              
            
       </div>

        <div class="group_list" style="display: none;">
                                                                  
            <div class="form-item cf">
                <label class="item-label">技术领域<span class="check-tips"></span></label>
                <div class="controls">
                   <select name="labfid" size="1" id="type">
							    <option>请选择类型</option>
							     <foreach name='cate' item='v'>
							         <option value="{$v['id']}">{$v.name}</option>
							     </foreach>
							 </select>
							
							 <select name="labkid" size="1" id="lables">

							 </select>
                </div>
            </div>
   
          
            </br>
            
            <div class="form-item cf">
                <label class="item-label">成熟度<span class="check-tips"></span></label>

                <div class="controls">
	                <label class="line-height-1 blue">
	                    <input name="csd" value="1" type="radio" >
	                    <span class="lbl"> 理论验证</span>
	                </label>

	                <label class="line-height-1 blue">
	                    <input name="csd" value="2" type="radio">
	                    <span class="lbl"> 原型机</span>
	                </label>
	                
	                <label class="line-height-1 blue">
	                    <input name="csd" value="3" type="radio">
	                    <span class="lbl"> 中试样机</span>
	                </label>
	                
	                <label class="line-height-1 blue">
	                    <input name="csd" value="4" type="radio" >
	                    <span class="lbl"> 产业化</span>
	                </label>
                </div>
            </div>
            
            </br>
            
            <div class="form-item cf">
                <label class="item-label">合作方式<span class="check-tips"></span></label>

                <div class="controls">
	                <label class="line-height-1 blue">
	                    <input name="hztype" value="1" type="radio" >
	                    <span class="lbl">专利合作</span>
	                </label>

	                <label class="line-height-1 blue">
	                    <input name="hztype" value="2" type="radio">
	                    <span class="lbl">市场合作</span>
	                </label>
	                
	                <label class="line-height-1 blue">
	                    <input name="hztype" value="3" type="radio">
	                    <span class="lbl">供货合作</span>
	                </label>
	                <label class="line-height-1 blue">
	                    <input name="hztype" value="4" type="radio">
	                    <span class="lbl">合作开发</span>
	                </label>
	                 <label class="line-height-1 blue">
	                    <input name="hztype" value="5" type="radio">
	                    <span class="lbl">投资孵化</span>
	                </label>
	                 <label class="line-height-1 blue">
	                    <input name="hztype" value="6" type="radio">
	                    <span class="lbl">可议</span>
	                </label>
                </div>
            </div>
            
            </br>
            
                  <div class="form-item cf">
		                <label class="item-label">在线视频播放地址<span class="check-tips"></span></label>
		
		                <div class="controls">
		                    <input type="text" class="text input-large form-control form-input-width" name="number"
		                           value="{$data.shipin}">
		                </div>
                   </div>
                  
             </br>      
                                                                   
			      <!--<div class="form-group">
			            <label class="col-sm-2 control-label no-padding-mid" for="title"> 字段管理 </label>
			
			            <div class="add">
				        	<div data-original-title="只有新增了字段，该表才会真正建立" class="col-xs-12 col-sm-5 tooltip-info" data-rel="tooltip" data-placement="right">
								<span>字段列表 [ <a href="{:U('Attribute/add?model_id='.$info['id'])}" target="_balnk">新增</a> <a href="{:U('Attribute/index?model_id='.$info['id'])}" target="_balnk">管理</a> ] </span>
								<ul class="dd-list">
									<foreach name="fields" item="field" key="k">
									<li >
										<em ><input class="ids" type="checkbox" name="attribute_list[]" value="{$field['id']}"  /> {$field['title']} [{$field['name']}]</em>
									</li>
									</foreach>
								</ul>
							</div>
				            <span class="help-inline col-xs-12 col-sm-7">
				                <span class="middle">  </span>
				            </span>
			          </div>
			      </div>  -->    
<!-- 技术标签的选择 -->			     
		<!--<div style="height:450px">
		<label class="item-label fl" >技术标签</label>
			<div class="choosed well center-block col-md-3" style="background:grey">
				<form action="" class="choosed-form">
				<volist name="_list" id="vo">
					<input class="btn btn-info btn-block btn-sm"  type="button" name="id" value="{$vo.tID}" data-id="{$vo.id}" />
					</volist>
				</form>
			</div>
			<br/>
			<label class="item-label fl" >推荐标签</label>
			<div class="not-choosed well center-block col-md-3">
				<volist name="n_list" id="nvo">
				<input class="btn btn-info btn-block btn-sm" type="button" name="lable" value="{$nvo.lable}" data-id="{$nvo.id}" />
				</volist>
			</div>
			</div> 
		        <input type="text" value="{$rst.lable}" name="lable" id="ids"></input>		                                           
        </div>
    </div>  -->
    
		      <div class="form-item cf">
			       <label class="item-label">技术标签<span class="check-tips"></span></label>
			
			       <div class="controls">
			           <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="1" type="checkbox" checked="checked">
		                    <span class="lbl">技术创新</span>
	                    </label>
                        
		                <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="2" type="checkbox">
		                    <span class="lbl">创新</span>
		                </label>
	                
		                <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="3" type="checkbox">
		                    <span class="lbl">节能环保</span>
		                </label>
		                
		                <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="4" type="checkbox">
		                    <span class="lbl">智能家电</span>
		                </label>
		                 <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="5" type="checkbox">
		                    <span class="lbl">节能</span>
		                </label>
		                 <label class="line-height-1 blue" style="margin-right:20px">
		                    <input name="tID[]" value="6" type="checkbox">
		                    <span class="lbl">健康</span>
		                </label>
			       </div>
			  </div>
			  
		 <div class="form-item cf">
			       <label class="item-label">上传附件<span class="check-tips"></span></label>
			       <div class="controls">
                       <input type="file" name="file1" style="margin: 0px 0px 0px 0px;">    
                  </div>
                </div> 
              </br>
			  
         </div> 
    
</div>
 

        <script>
            $(function () {
                var uploader_= WebUploader.create({
                    // 选完文件后，是否自动上传。
                    auto: true,
                    // swf文件路径
                    swf: 'Uploader.swf',
                    // 文件接收服务端。
                    server: "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                    // 选择文件的按钮。可选。
                    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                    pick: '#upload_single_image_',
                    // 只允许选择图片文件
                    accept: {
                        title: 'Images',
                        extensions: 'gif,jpg,jpeg,bmp,png',
                        mimeTypes: 'image/*'
                    }
                });
                uploader_.on('fileQueued', function (file) {
                    uploader_.upload();
                });
                /*上传成功**/
                uploader_.on('uploadSuccess', function (file, data) {
                    if (data.status) {
                        $("[name='']").val(data.id);
                        $("[name='']").parent().find('.upload-pre-item').html(
                                '<input type="hidden" name="pic" value="'+ data.path+'"/><div class="each"><a href="'+ data.path+'" title="点击查看大图"><img src="'+ data.path+'"></a><div class="text-center opacity del_btn" ></div>' +
                                        '<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div></div>'
                        );
                        uploader_.reset();
                    } else {
                        updateAlert(data.info);
                        setTimeout(function () {
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled', false);
                        }, 1500);
                    }
                });
            })
        </script> 
<!-- 单图
		<div class="controls multiImage">
            <div id="upload_multi_image_" style="padding-bottom: 5px;">选择图片</div>
            <input class="attach" type="hidden" name="" value=""/>
            <div class="upload-img-box">
                <div class="upload-pre-item popup-gallery">

                                    </div>
            </div>
        </div>
        <script>
            $(function () {
                var id = "#upload_multi_image_";
                var limit = parseInt('');
                var uploader_= WebUploader.create({
                    // 选完文件后，是否自动上传。
                      // swf文件路径                    swf: 'Uploader.swf',
                    // 文件接收服务端。
                    server: "/duijie/admin.php?s=/file/uploadpicture/session_id/fuvf1hvfgihg9n5v6v63rc0022.html",
                    // 选择文件的按钮。可选。
                    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                    //pick: '#upload_multi_image_',
                    pick: {'id': id, 'multi': true},
                    fileNumLimit: limit,
                    // 只允许选择图片文件。
                    accept: {
                        title: 'Images',
                        extensions: 'gif,jpg,jpeg,bmp,png',
                        mimeTypes: 'image/*'
                    }
                });
                uploader_.on('fileQueued', function (file) {
                    uploader_.upload();
                });
                uploader_.on('uploadFinished', function (file) {
                    uploader_.reset();
                });
                /*上传成功**/
                uploader_.on('uploadSuccess', function (file, data) {
                          if (data.status) {
                            var ids = $("[name='']").val();
                            ids = ids.split(',');
                          if( ids.indexOf(data.id) == -1){
                                var rids = admin_image.upAttachVal('add',data.id, $("[name='']"));
                              if(rids.length>limit){
                                  updateAlert('超过图片限制');
                                  return;
                              }
                              $("[name='']").parent().find('.upload-pre-item').append(
                                        ' <div class="each"><a href="'+ data.path+'" title="点击查看大图"><img src="'+ data.path+'"></a><div class="text-center opacity del_btn" ></div>' +
                                                '<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div></div>'
                                );
                            }else{
                                updateAlert('该图片已存在');
                            }
                        } else {
                            updateAlert(data.info);
                            setTimeout(function () {
                                $('#top-alert').find('button').click();
                                $(that).removeClass('disabled').prop('disabled', false);
                            }, 1500);
                        }
                });
            })
        </script>--></div> 
								
            <div class="form-item">
                <input type="hidden" name="id" value="{$data.id}"/>
                <button class="btn submit-btn ajax-post btn-success" id="submit" type="submit" target-form="form-horizontal" style="margin-left:12px">保存</button>
<!--                 <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">保存</button> -->
<!--                 <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">确定</button> -->
            </div>
        </form>
    </div>

</block>

<block name="script">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript" charset="utf-8">
    Think.setValue('csd', {$data.csd|default = 1});
    Think.setValue('hztype', {$data.hztype|default = 1});
        //导航高亮
     highlight_subnav('{:U('Techolder/tecach')}');
    </script>
    
    <link type="text/css" rel="stylesheet" href="/duijie/Public/js/ext/magnific/magnific-popup.css"/>
    <script type="text/javascript" src="/duijie/Public/js/ext/magnific/jquery.magnific-popup.min.js"></script>

    <script type="text/javascript" charset="utf-8" src="/duijie/Public/js/ext/webuploader/js/webuploader.js"></script>
    <link href="/duijie/Public/js/ext/webuploader/css/webuploader.css" type="text/css" rel="stylesheet">

    <script type="text/javascript">
    $(function () {
        $('.group_nav li a').click(function () {
            $('.group_list').hide();
            $('.group_list').eq($(".group_nav li a").index(this)).show();
            $('.group_nav li').removeClass('active');
            $(this).parent().addClass('active');
        })
    })
    </script>


    <script>
        $(document).ready(function () {
            $('.popup-gallery').each(function () { // the containers for all your galleries
                $(this).magnificPopup({
                    delegate: 'a',
                    type: 'image',
                    tLoading: '正在载入 #%curr%...',
                    mainClass: 'mfp-img-mobile',
                    gallery: {
                        enabled: true,
                        navigateByImgClick: true,
                        preload: [0, 1] // Will preload 0 - before current, and 1 after the current image

                    },
                    image: {
                        tError: '<a href="%url%">图片 #%curr%</a> 无法被载入.',
                        titleSrc: function (item) {
                            /*           return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';*/
                            return '';
                        },
                        verticalFit: true
                    }
                });
            });
                    });
    </script>
  <!--   二级联动 -->
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
    $('#type').click(function(){
        $(this).change(function(){
            var objectModel = {};
            var   value = $(this).val();
           var   type = $(this).attr('id');
          // var   lable = $(this).attr('id');
            objectModel[type] =value;
           // objectModel[lable] =value;
            $.ajax({
                cache:false,
                type:"POST",
                url:'{:U('lable')}',
                dataType:"json",
                data:objectModel,
                timeout:30000,
                error:function(){
                    alert(site.web+"lable");
                },
                success:function(data){
                    $("#lables").empty();
                    var count = data.length;
                    var i = 0;
                    var b="";
                       for(i=0;i<count;i++){
                           b+="<option value='"+data[i].id+"'>"+data[i].name+"</option>";
                       }
                    $("#lables").append(b);
                }
            });
           });
    }
);
    
    $('.choosed-form , .not-choosed').ace_scroll({size: 300});
    $.app = {
    	students:function(){
    		setChoosed();
    		function setChoosed(){
    			// resizeScroll();
    			var ids = [];
    			var not_ids = [];
    			$(".choosed-form input").each(function(){
    				ids[ids.length] = $(this).data("id");
    			});
    			$(".not-choosed input").each(function(){
    				not_ids[not_ids.length] = $(this).data("id");
    			});
    			$("#ids").attr("value",ids);
    			$("#not_ids").attr("value",not_ids);
    			$(".choosed-form input").unbind("click").bind("click",choose);
    			$(".not-choosed input").unbind("click").bind("click",unchoose);
    		}
    		function choose(){
    			$(this).prependTo(".not-choosed .scroll-content");
    			$(this).removeClass('animated lightSpeedIn')
    				   .addClass('animated fadeInLeft');
    			setChoosed();
    		}
    		function unchoose(){
    			$(this).prependTo(".choosed-form .scroll-content");
    			$(this).removeClass('animated fadeInLeft')
    			       .addClass('animated lightSpeedIn');
    			setChoosed();

    		}
    	}
    }
    //执行
    $.app.students();
    
    </script>
       
</block>
